<template>
  <div class="app">
    <el-alert v-show="showSuccessNotice"
      title="充值密码成功"
      type="success"
      show-icon style="margin-bottom:20px;">
    </el-alert>
    <el-alert v-show="showErrorNotice"
      title="充值密码失败"
      type="error"
      show-icon style="margin-bottom:20px;">
    </el-alert>
    <el-form ref="form" label-width="120px">
      <el-form-item label="密码">
        <el-input type="password" v-model="password"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button size="small" type="primary" v-on:click="submitHandler">修改密码</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { resetPwd } from '@/api/admin'
export default {
  name: 'AdminResetPwd',
  data: function() {
    // 属性
    return {
      showSuccessNotice: false,
      showErrorNotice: false,
      password: ''
    }
  },
  props: [
    'id'
  ],
  methods: {
    submitHandler() {
      resetPwd(this.id, this.password).then(response => {
        console.log(response)
        this.$message({message: '密码修改成功', 'type': 'success'})
      })
    }
  }
}
</script>

